import Vue from 'vue';
import vm from '@/main';
import ModifyPwd from './modify-pwd.vue';

const ModifyPwdConstructor = Vue.extend(ModifyPwd);

let instance;

const openModifyPwd = (closeable = true) => {
  instance = new ModifyPwdConstructor();
  instance.vm = instance.$mount();
  document.body.appendChild(instance.$el);
  instance.dialogVisible = true;
  instance.username = vm.$store.state.user.userInfo.username;
  instance.dom = instance.$el;
  instance.closeable = closeable;
  return instance;
}

function modifyPwd() {
  Vue.prototype.$modifyPwd = openModifyPwd;
}

export default modifyPwd;